package com.mashibing.controller;

import com.mashibing.internalcommon.dto.ResponseResult;
import com.mashibing.internalcommon.response.TerminalResponse;
import com.mashibing.internalcommon.response.TrsearchResponse;
import com.mashibing.service.TerminalMapService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class TerminalController {

    @Autowired
    private TerminalMapService terminalMapService;

    @PostMapping("/addTerminal")
    public ResponseResult<TerminalResponse> addTerminal(String name, String desc) {
        return terminalMapService.addTerminal(name, desc);
    }

    /**
     * 终端搜索
     *
     * @param center
     * @param radius
     * @return
     */
    @PostMapping("/aroundSearch")
    public ResponseResult<List<TerminalResponse>> aroundSearch(String center, Integer radius) {
        return terminalMapService.aroundsearch(center, radius);
    }

    /**
     * 轨迹查询
     * @param tid
     * @param starttime
     * @param endtime
     * @return
     */
    @PostMapping("/trackSearch")
    public ResponseResult<TrsearchResponse> trackSearch(String tid, Long starttime , Long endtime){
        return terminalMapService.trackSearch(tid,starttime,endtime);
    }
}
